package com.intretech.tj.device;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.Objects;

@Getter
public enum Type {
    Car("车辆", "car_"),
    Light("红绿灯", "light_"),
    Gate("闸机", "gate_"),
    MEC("MEC", "mec_"),
    HMBQ("毫米波雷达", "hmbq_"),
    Camera("摄像头", "camera_"),
    Lidar("激光雷达", "lidar_"),
    Show("显示屏", "show_"),
    Dummy("假人", "dummy_"),
    RSU("RSU", "rsu_");

    private final String name;
    @JsonValue
    private final String title;

    Type(String name, String title) {
        this.name = name;
        this.title = title;
    }

    public static Type valueOfTitle(String title) {
        for (Type type : values()) {
            if (Objects.equals(type.title, title)) {
                return type;
            }
        }
        return null;
    }
}
